package com.rc.saas.tenant.service.ugs;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.base.BaseSearch;
import com.rc.saas.tenant.mapper.ugs.TenantUgsLevelTypeMapper;
import com.rc.saas.tenant.model.ugs.TenantUgsLevelType;
import com.rc.saas.tenant.model.ugs.TenantUgsLevelTypeExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author frog
 * @date 2021/4/2
 */
@Service
public class TenantUgsLevelTypeServiceImpl implements TenantUgsLevelTypeService {

    @Autowired
    private TenantUgsLevelTypeMapper tenantUgsLevelTypeMapper;

    @Override
    public TenantUgsLevelTypeMapper getMapper() {
        return tenantUgsLevelTypeMapper;
    }

    @Override
    public PageInfo<TenantUgsLevelType> listPageTenantUgsLevelType(BaseSearch search) {
        PageHelper.startPage(search.getOffset(), search.getLimit());
        TenantUgsLevelTypeExample example = new TenantUgsLevelTypeExample();
        example.createCriteria().andTenantCodeEqualTo(search.getTenantCode());
        List<TenantUgsLevelType> tenantUgsLevelTypelist = tenantUgsLevelTypeMapper.selectByExample(example);
        return new PageInfo<TenantUgsLevelType>(tenantUgsLevelTypelist);
    }
}
